{% extends "swaps/base.html" %}

{% load i18n %}
{% load humanize %}
{% load account_tags %}
{% load pagination_tags %}
{% load shorttimesince_tag %}

{% block head_title %}{% blocktrans %}Swaps proposed to you{% endblocktrans %}{% endblock %}

{% block body %}
    <h1>{% trans "Swaps proposed to you" %}</h1>
    
    {% if swaps %}
        
        {% autopaginate swaps %}
        
        <table class="tasks" >
            <tr>
                <th>Proposal Time</th>
                <th>Proposing Offer</th>
                <th>Offered By</th>
                <th>Your Offer</th>
                <th>State</th>
            </tr>
            {% for swap in swaps %}
                <tr class="{% cycle odd,even %}">
                    <td><a href="{{ swap.get_absolute_url }}">{{ swap.proposed_time|shorttimesince }}</a></td>
                    <td>{{ swap.proposing_offer }}</td>
                    <td>{% user_display swap.proposing_offer.offerer %}</td>
                    <td>{{ swap.responding_offer }}</td>
                    <td>{{ swap.get_state_display }}</td>
                    <td>
                        <form style="display: inline;" action="{% url accept_swap swap.id %}" method="POST">
                            {% csrf_token %}
                            <input type="submit" value="{% trans "Accept" %}" />
                        </form>
                        <form style="display: inline;" action="{% url reject_swap swap.id %}" method="POST">
                            {% csrf_token %}
                            <input type="submit" value="{% trans "Reject" %}" />
                        </form>
                    </td>
                </tr>
            {% endfor %}
        </table>
        
        {% paginate %}
        
    {% else %}
        <p>No proposed swaps.</p>
    {% endif %}
    
{% endblock %}